<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Level extends CI_Controller {
	function __construct(){
		parent::__construct();
		$this->load->library('Huashang/user');
		$this->user->checkLogin();
	}
	
	//载入会员列表
	public function index(){
		$data['type']=$this->uri->segment(3);
	    $data['auth']=explode(',', $this->input->get('auth'));
		$this->load->view('level/index',$data);
	}
	//获取会员列表
	public function getlist()
    {
        echo json_encode(
            array(
                'total' =>  5,
                'rows'  =>  array(
                    array('id'=>1, 'level'=>0, 'name'=>'test', 'desc'=>'超级vip', 'join_time'=>date('Y-m-d H:i:s'), 'income_count'=>100, 'income'=>2000, 'member_count'=>2000, 'rec_acc_count'=>222, 'pay_acc_count'=>200, 'remark'=>'jjkokkoal'),
                    array('id'=>2, 'level'=>2, 'name'=>'test', 'desc'=>'超级vip', 'join_time'=>date('Y-m-d H:i:s'), 'income_count'=>100, 'income'=>2000, 'member_count'=>2000, 'rec_acc_count'=>222, 'pay_acc_count'=>200, 'remark'=>'jjkokkoal'),
                    array('id'=>3, 'level'=>3, 'name'=>'test', 'desc'=>'超级vip', 'join_time'=>date('Y-m-d H:i:s'), 'income_count'=>100, 'income'=>2000, 'member_count'=>2000, 'rec_acc_count'=>222, 'pay_acc_count'=>200, 'remark'=>'jjkokkoal'),
                    array('id'=>4, 'level'=>4, 'name'=>'test', 'desc'=>'超级vip', 'join_time'=>date('Y-m-d H:i:s'), 'income_count'=>100, 'income'=>2000, 'member_count'=>2000, 'rec_acc_count'=>222, 'pay_acc_count'=>200, 'remark'=>'jjkokkoal'),
                    array('id'=>5, 'level'=>5, 'name'=>'test', 'desc'=>'超级vip', 'join_time'=>date('Y-m-d H:i:s'), 'income_count'=>100, 'income'=>2000, 'member_count'=>2000, 'rec_acc_count'=>222, 'pay_acc_count'=>200, 'remark'=>'jjkokkoal'),
                )
            ), JSON_UNESCAPED_UNICODE);
	}
	//保存会员列表
	public function save(){
		$id 		   			= $this -> input -> post('id');
		$row['gg_sort_order'] 	= $this -> input -> post('gg_sort_order');
		if($this -> user -> save($id,$row) && $this -> admin_sh -> add($sh)){
			echo '{"status":"OK","msg":"执行成功"}';
		}else{
			echo '{"status":"ERROR","msg":"执行失败"}';
		}
	}

	//修改会员
	public function edituser()
    {
	    $data = array();
		$this->load->view('level/edituser',$data);
	}

	//删除会员
	public function deluser(){
		$this->user->remove();
	}

	//支付设定
	public function pay_set(){
		$this->load->view('level/pay_set');
	}
}